package cn.bugDance.test.infrastructure.dao;


import cn.bugDance.domain.rebate.model.entity.UserCalendarQuotaEntity;
import cn.bugDance.domain.rebate.repository.IRebateRepository;
import cn.bugDance.domain.rebate.service.ICalendarQuotaService;
import cn.bugDance.domain.rebate.service.IRebateQuotaService;
import cn.bugDance.infrastructure.persistent.dao.*;
import cn.bugDance.infrastructure.persistent.po.*;
import cn.bugDance.infrastructure.persistent.redis.IRedisService;
import cn.bugstack.middleware.db.router.strategy.IDBRouterStrategy;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.util.Date;
import java.util.Map;

@SpringBootTest
@RunWith(SpringRunner.class)
@Slf4j
public class AwardDaoTest {

    @Resource
    private IAwardDao awardDao;
    @Resource
    private ITaskDao taskDao;
    @Resource
    private IDBRouterStrategy dbRouter;
    @Resource
    private IActivityDao activityDao;
    @Resource
    private IRedisService redisService;
    @Resource
    private IActivitySkuOrderDao activitySkuOrderDao;
    @Resource
    private IUserCheckInOrderDao userCheckInOrderDao;
    @Resource
    private IRebateRepository rebateRepository;
    @Resource
    private ICalendarQuotaService calendarQuotaService;

    @Test
    public void test_getAwardByAwardId(){
        dbRouter.setDBKey(1);
        dbRouter.setTBKey(0);
        Task task = taskDao.getTask("1001");
        log.info("结果为: {}", JSON.toJSONString(task));
    }

    @Test
    public void test(){
        ActivitySkuOrder activitySkuOrderReq = new ActivitySkuOrder();
        activitySkuOrderReq.setUserId("yangxiaocan");
        activitySkuOrderReq.setSku(1003L);
        activitySkuOrderReq.setTradeType("credit_pay");

        ActivitySkuOrder activitySkuOrder = activitySkuOrderDao.queryUnPaidActivitySkuOrder(activitySkuOrderReq);
        log.info("结果为: {}", JSON.toJSONString(activitySkuOrder));
    }

    @Test
    public void test_queryCheckInOrder(){
        UserCalendarQuotaEntity userCalendarQuotaEntity = calendarQuotaService.queryUserCalendarQuota("yangxiaocan", 100301L);
        log.info("结果为: {}", JSON.toJSONString(userCalendarQuotaEntity));
    }
}
